home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / byte-benchmarks / part02 < prev    next >
Encoding:
Internet Message Format  |  1990-06-07  |  51.3 KB

  1. Subject:  v22i029:  Byte Unix benchmarks, Part02/05
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 7bdcf645 c4412bf6 22ef7144 85377d6b
  5.  
  6. Submitted-by: "Ben Smith @ BYTE" <ben@bytepb.byte.com>
  7. Posting-number: Volume 22, Issue 29
  8. Archive-name: byte-benchmarks/part02
  9.  
  10. [  Look out for the BEL characters on line 94 of Run, and line 30 of sort.src. ]
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 2 (of 5)."
  19. # Contents:  Makefile Run dummy.c fstime.c precision.c sort.src
  20. # Wrapped by rsalz@papaya.bbn.com on Tue May  8 08:55:29 1990
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'Makefile'\"
  24. else
  25. echo shar: Extracting \"'Makefile'\" \(7106 characters\)
  26. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  27. X##############################################################################
  28. X#  The BYTE UNIX Benchmarks - Release 2
  29. X#          Module: Makefile   SID: 2.10 4/17/90 16:45:28
  30. X#          
  31. X##############################################################################
  32. X# Bug reports, patches, comments, suggestions should be sent to:
  33. X#
  34. X#    Ben Smith or Rick Grehan at BYTE Magazine
  35. X#    bensmith@bytepb.UUCP    rick_g@bytepb.UUCP
  36. X#
  37. X##############################################################################
  38. X#  Modification Log: 7/28/89 cleaned out workload files
  39. X#                    4/17/90 added routines for installing from shar mess
  40. X#
  41. X##############################################################################
  42. XID="@(#)Makefile:2.10 -- 4/17/90 16:45:28";
  43. XSHELL = /bin/sh
  44. XUNIX = -DSysV     #may be: SysV, BSD4v1, BSD4v2
  45. XCFLAGS = $(UNIX) -DHZ=50
  46. XOPTON = -O        #optimization on (give it your best shot) 
  47. X                  #            -- check your compiler man
  48. XOPTOFF = -Od      #optimization off -- check your compiler man
  49. X# local directories
  50. XBINDIR = ./pgms
  51. XSRCDIR = ./src
  52. XDOCDIR = ./doc
  53. XTESTDIR = ./testdir
  54. XRESULTDIR = ./resultdir
  55. XTMPDIR = ./tmpdir
  56. X# other directories
  57. XINCLDIR = /usr/include
  58. XLIBDIR = /lib
  59. XSCRIPTS = BSDtime.awk SysVtime.awk byte.logo \
  60. X    cleanup dbprep dhry.awk \
  61. X    fs.awk multi.sh \
  62. X    time.awk tst.sh
  63. XSOURCES = arith.c big.c buildbms.c \
  64. X    clock.c context1.c \
  65. X    dbmscli.c dbmserv.c dhry.c \
  66. X    dhry.h dummy.c execl.c \
  67. X    fstime.c getopt.c hanoi.c \
  68. X    limit.c mkperm.c \
  69. X    pipe.c precision.c spawn.c \
  70. X    syscall.c 
  71. XDOCS = bench.doc
  72. XTESTS = sort.src cctest.c 
  73. XPROGS = $(BINDIR)/arithoh $(BINDIR)/register $(BINDIR)/short \
  74. X    $(BINDIR)/int $(BINDIR)/long $(BINDIR)/float $(BINDIR)/double \
  75. X    $(BINDIR)/hanoi \
  76. X    $(BINDIR)/fstime $(BINDIR)/syscall $(BINDIR)/context1 \
  77. X    $(BINDIR)/pipe $(BINDIR)/spawn $(BINDIR)/execl \
  78. X    $(BINDIR)/dhry2 $(BINDIR)/dhry2reg $(BINDIR)/limit \
  79. X    $(BINDIR)/clock $(BINDIR)/precision $(BINDIR)/mkperm \
  80. X    $(BINDIR)/buildbms $(BINDIR)/dbmserv $(BINDIR)/dbmscli 
  81. X
  82. X# ######################### the big ALL ############################
  83. Xall: distr programs
  84. X
  85. X# distribute the files out to subdirectories if they are in this one
  86. Xdistr: 
  87. X    # scripts
  88. X    if  test ! -d  $(BINDIR) \
  89. X        ; then  \
  90. X           mkdir $(BINDIR) \
  91. X           ; mv $(SCRIPTS) $(BINDIR) \
  92. X        ; else \
  93. X           echo "$(BINDIR)  exists" \
  94. X        ; fi
  95. X    # C sources
  96. X    if  test ! -d  $(SRCDIR) \
  97. X        ; then  \
  98. X           mkdir $(SRCDIR) \
  99. X           ; mv $(SOURCES) $(SRCDIR) \
  100. X        ; else \
  101. X           echo "$(SRCDIR)  exists" \
  102. X        ; fi
  103. X    # test data
  104. X    if  test ! -d  $(TESTDIR) \
  105. X        ; then  \
  106. X           mkdir $(TESTDIR) \
  107. X           ; mv $(TESTS) $(TESTDIR) \
  108. X        ; else \
  109. X           echo "$(TESTDIR)  exists" \
  110. X        ; fi
  111. X    # documents directory
  112. X    if  test ! -d  $(DOCDIR) \
  113. X        ; then  \
  114. X           mkdir $(DOCDIR) \
  115. X       ; mv $(DOCS) $(DOCDIR) \
  116. X        ; else \
  117. X           echo "$(DOCDIR)  exists" \
  118. X        ; fi
  119. X    # temporary work directory
  120. X    if  test ! -d  $(TMPDIR) \
  121. X        ; then  \
  122. X           mkdir $(TMPDIR) \
  123. X        ; else \
  124. X           echo "$(TMPDIR)  exists" \
  125. X        ; fi
  126. X    # directory for results
  127. X    if  test ! -d  $(RESULTDIR) \
  128. X        ; then  \
  129. X           mkdir $(RESULTDIR) \
  130. X        ; else \
  131. X           echo "$(RESULTDIR)  exists" \
  132. X        ; fi
  133. X    chmod 744 * $(SRCDIR)/* $(BINDIR)/* $(TESTDIR)/* $(DOCDIR)/*
  134. X
  135. Xprograms: $(PROGS)
  136. X
  137. X# Individual programs
  138. X$(BINDIR)/arithoh:    $(SRCDIR)/arith.c
  139. X    cc -o $(BINDIR)/arithoh ${CFLAGS} ${OPTON} -Darithoh $(SRCDIR)/arith.c
  140. X$(BINDIR)/register: $(SRCDIR)/arith.c
  141. X    cc -o $(BINDIR)/register ${CFLAGS} ${OPTON} -Ddatum=register $(SRCDIR)/arith.c
  142. X$(BINDIR)/short: $(SRCDIR)/arith.c
  143. X    cc -o $(BINDIR)/short ${CFLAGS} ${OPTON} -Ddatum=short $(SRCDIR)/arith.c
  144. X$(BINDIR)/int: $(SRCDIR)/arith.c
  145. X    cc -o $(BINDIR)/int ${CFLAGS} ${OPTON} -Ddatum=int $(SRCDIR)/arith.c
  146. X$(BINDIR)/long: $(SRCDIR)/arith.c
  147. X    cc -o $(BINDIR)/long ${CFLAGS} ${OPTON} -Ddatum=long $(SRCDIR)/arith.c
  148. X$(BINDIR)/float: $(SRCDIR)/arith.c
  149. X    cc -o $(BINDIR)/float ${CFLAGS} ${OPTON} -Ddatum=float $(SRCDIR)/arith.c
  150. X$(BINDIR)/double: $(SRCDIR)/arith.c
  151. X    cc -o $(BINDIR)/double ${CFLAGS} ${OPTON} -Ddatum=double $(SRCDIR)/arith.c
  152. X$(BINDIR)/hanoi: $(SRCDIR)/hanoi.c
  153. X    cc -o $(BINDIR)/hanoi ${CFLAGS} ${OPTON} $(SRCDIR)/hanoi.c
  154. X$(BINDIR)/fstime: $(SRCDIR)/fstime.c
  155. X    cc -o $(BINDIR)/fstime ${CFLAGS} ${OPTON} -Dawk=1 $(SRCDIR)/fstime.c
  156. X$(BINDIR)/syscall: $(SRCDIR)/syscall.c
  157. X    cc -o $(BINDIR)/syscall ${CFLAGS} ${OPTON} $(SRCDIR)/syscall.c
  158. X$(BINDIR)/context1: $(SRCDIR)/context1.c
  159. X    cc -o $(BINDIR)/context1 ${CFLAGS} ${OPTON} $(SRCDIR)/context1.c
  160. X$(BINDIR)/pipe: $(SRCDIR)/pipe.c
  161. X    cc -o $(BINDIR)/pipe ${CFLAGS} ${OPTON} $(SRCDIR)/pipe.c
  162. X$(BINDIR)/spawn: $(SRCDIR)/spawn.c
  163. X    cc -o $(BINDIR)/spawn ${CFLAGS} ${OPTON} $(SRCDIR)/spawn.c
  164. X$(BINDIR)/execl: $(SRCDIR)/execl.c $(SRCDIR)/big.c
  165. X    cc -o $(BINDIR)/execl ${CFLAGS} ${OPTON} $(SRCDIR)/execl.c
  166. X$(BINDIR)/keyb: $(SRCDIR)/keyb.c
  167. X    cc -o $(BINDIR)/keyb ${CFLAGS} ${OPTON} $(SRCDIR)/keyb.c
  168. X$(BINDIR)/limit: $(SRCDIR)/limit.c
  169. X    cc -o $(BINDIR)/limit ${CFLAGS} ${OPTON} $(SRCDIR)/limit.c
  170. X$(BINDIR)/dhry2: $(SRCDIR)/dhry.c $(SRCDIR)/dhry.h
  171. X    cc -o $(BINDIR)/dhry2 ${CFLAGS} ${OPTON} $(SRCDIR)/dhry.c
  172. X$(BINDIR)/dhry2reg: $(SRCDIR)/dhry.c $(SRCDIR)/dhry.h
  173. X    cc -o $(BINDIR)/dhry2reg -DREG=register ${CFLAGS} ${OPTON} $(SRCDIR)/dhry.c
  174. X$(BINDIR)/clock: $(SRCDIR)/clock.c
  175. X    cc -o $(BINDIR)/clock ${CFLAGS} ${OPTON} $(SRCDIR)/clock.c
  176. X$(BINDIR)/precision: $(SRCDIR)/precision.c
  177. X    cc -o $(BINDIR)/precision ${CFLAGS} ${OPTON} $(SRCDIR)/precision.c
  178. X$(BINDIR)/ttychk: $(SRCDIR)/ttychk.c
  179. X    cc -o $(BINDIR)/ttychk ${CFLAGS} ${OPTON} $(SRCDIR)/ttychk.c
  180. X$(BINDIR)/mkperm: $(SRCDIR)/mkperm.c
  181. X    cc -o $(BINDIR)/mkperm ${CFLAGS} ${OPTON} $(SRCDIR)/mkperm.c
  182. X$(BINDIR)/buildbms: $(SRCDIR)/buildbms.c
  183. X    cc -o $(BINDIR)/buildbms ${CFLAGS} ${OPTON} $(SRCDIR)/buildbms.c
  184. X$(BINDIR)/dbmserv: $(SRCDIR)/dbmserv.c
  185. X    cc -o $(BINDIR)/dbmserv ${CFLAGS} ${OPTON} $(SRCDIR)/dbmserv.c
  186. X$(BINDIR)/dbmscli: $(SRCDIR)/dbmscli.c
  187. X    cc -o $(BINDIR)/dbmscli ${CFLAGS} ${OPTON} $(SRCDIR)/dbmscli.c
  188. X$(BINDIR)/autokb: $(SRCDIR)/autokb.c
  189. X    cc -o $(BINDIR)/autokb ${CFLAGS} ${OPTON} $(SRCDIR)/autokb.c
  190. X
  191. X# SCCS stuff
  192. X
  193. Xdelta:
  194. X    delta -y"development step" sccs/s.Run sccs/s.README
  195. X    cd src; delta -y"development step" sccs
  196. X    cd pgms; delta -y"development step" sccs
  197. X    cd testdir; delta -y"development step" sccs
  198. X    cd doc; delta -y"development step" sccs
  199. Xget:
  200. X    get -e sccs/s.Run sccs/s.README
  201. X    cd src; get -e sccs
  202. X    cd pgms; get -e sccs
  203. X    cd testdir; get -e sccs
  204. X    cd doc; get -e sccs
  205. X    chmod 744 $(SRCDIR)/* $(DATAFILES)
  206. X    chmod 755 $(BINDIR)/* *
  207. Xrel:
  208. X    #cd bench; find . -type f -print | rm -f
  209. X    cd bench; get ../sccs
  210. X    cd bench/src; get ../../src/sccs
  211. X    cd bench/pgms; get ../../pgms/sccs
  212. X    cd bench/testdir; get ../../testdir/sccs
  213. X    cd bench/doc; get ../../doc/sccs
  214. X    cd bench; chmod 744 src/* testdir/*
  215. X    cd bench; chmod 755 * pgms/*
  216. X
  217. Xtar48:
  218. X    format /dev/rdsk/f05d9t 
  219. X    tar cfb /dev/rdsk/f05d9t 20 bench
  220. X    tar tf /dev/rdsk/f05d9t 
  221. X
  222. Xtar96:
  223. X    format /dev/rdsk/f05ht
  224. X    tar cfb /dev/rdsk/f05ht 20 bench
  225. X    tar tf /dev/rdsk/f05ht
  226. X
  227. Xtar135:
  228. X    format /dev/rdsk/f13dt
  229. X    tar cfb /dev/rdsk/f13dt 20 bench
  230. X    tar tf /dev/rdsk/f13dt
  231. END_OF_FILE
  232. if test 7106 -ne `wc -c <'Makefile'`; then
  233.     echo shar: \"'Makefile'\" unpacked with wrong size!
  234. fi
  235. chmod +x 'Makefile'
  236. # end of 'Makefile'
  237. fi
  238. if test -f 'Run' -a "${1}" != "-c" ; then 
  239.   echo shar: Will not clobber existing file \"'Run'\"
  240. else
  241. echo shar: Extracting \"'Run'\" \(13521 characters\)
  242. sed "s/^X//" >'Run' <<'END_OF_FILE'
  243. X#! /bin/sh
  244. X#################### set your default list of tests here ##############
  245. X
  246. XFULL_SUITE="dhry2 dhry2reg arithoh register short int long float double syscall pipe context1 spawn execl fstime shell dc hanoi"
  247. X
  248. X###############################################################################
  249. X#  The BYTE UNIX Benchmarks - Release 2
  250. X#          Module: Run   SID: 2.6 4/17/90 16:45:27
  251. X#          
  252. X###############################################################################
  253. X# Bug reports, patches, comments, suggestions should be sent to:
  254. X#
  255. X#    Ben Smith,        Rick Grehan, or      Tom Yager at BYTE Magazine
  256. X#    ben@bytepb.UUCP   rick_g@bytepb.UUCP   tyager@bytepb.UUCP
  257. X# BIX:  bensmith          rick_g               tyager
  258. X#
  259. X###############################################################################
  260. X#  Modification Log:
  261. X# $Header: run,v 5.2 88/01/12 06:23:43 kenj Exp $
  262. X#     Ken McDonell, Computer Science, Monash University
  263. X#     August 1, 1983
  264. X# 3/89 - Ben Smith - BYTE: globalized many variables, modernized syntax
  265. X# 5/89 - commented and modernized. Removed workload items till they
  266. X#        have been modernized. Added database server test.
  267. X# 11/14/89 - Made modifications to reflect new version of fstime
  268. X#        and elimination of mem tests.
  269. X#
  270. X###############################################################################
  271. XID="@(#)Run:2.6 -- 4/17/90 16:45:27";
  272. Xversion="2.6"
  273. X#######################################################################
  274. X# General Purpose Benchmark
  275. X# based on the work by Ken McDonell, Computer Science, Monash University
  276. X#
  277. X#  You will need ...
  278. X#    awk cat cc chmod comm cp date dc df echo ed expr
  279. X#    kill ls make mkdir rm sed test time touch tty umask who
  280. X#
  281. X#  The following variables may be assigned external values to overide defaults
  282. X#
  283. X#  Test        Variable    Default        Use
  284. X#  all        iterations    6        repeat count for timing
  285. X#  dhry        dhryloops    10000        no. of loops to test
  286. X#  arithmetic    arithloop    10000        no. of summations
  287. X#  hanoi    ndisk        17        list of nos. of disks
  288. X#  syscall    ncall        4000        no. iterations, each of
  289. X#                          5 system calls
  290. X#  context1    switch1        500        no. of switches
  291. X#  pipe        io        2048        no. 512 byte blocks to read
  292. X#                          and write
  293. X#  spawn    children    100        no. of child processes
  294. X#  execl    nexecs        100        no. of execs
  295. X#  fstime    seconds        1 10 20         seconds
  296. X#
  297. Xumask 022    # at least mortals can read root's files this way
  298. X# establish full paths to directories
  299. XPWD=`pwd`
  300. XHOMEDIR=${HOMEDIR-.}
  301. Xcd $HOMEDIR
  302. XHOMEDIR=`pwd`
  303. Xcd $PWD
  304. X
  305. XBINDIR=${BINDIR-${HOMEDIR}/pgms}
  306. Xcd $BINDIR
  307. XBINDIR=`pwd`
  308. Xcd $PWD
  309. X# let's extend the path to this directory
  310. XPATH="${PATH}:${BINDIR}"
  311. X
  312. XSCRPDIR=${SCRPDIR-${HOMEDIR}/pgms}
  313. Xcd $SCRPDIR
  314. XSCRPDIR=`pwd`
  315. Xcd $PWD
  316. X
  317. XTMPDIR=${HOMEDIR}/tmp
  318. Xcd $TMPDIR
  319. XTMPDIR=`pwd`
  320. Xcd $PWD
  321. X
  322. XRESULTDIR=${RESULTDIR-${HOMEDIR}/results}
  323. Xcd $RESULTDIR
  324. XRESULTDIR=`pwd`
  325. Xcd $PWD
  326. X
  327. XTIMEACCUM=${TIMEACCUM-${RESULTDIR}/times}
  328. X
  329. XTESTDIR=${TESTDIR-${HOMEDIR}/testdir}
  330. Xcd $TESTDIR
  331. XTESTDIR=`pwd`
  332. Xcd $PWD
  333. X
  334. Xexport BINDIR TMPDIR RESULTDIR PATH TESTDIR TIMEACCUM
  335. X#
  336. Xbell=""
  337. Xbreak1="============================================================================="
  338. Xbreak2="-----------------------------------------------------------------------------"
  339. X#
  340. Xcat ${BINDIR}/byte.logo # display banner
  341. Xrm -f ${TIMEACCUM}      # clean out old time accumulation file
  342. Xecho "kill -9 $$" > ${TMPDIR}/kill_run ; chmod u+x ${TMPDIR}/kill_run
  343. X#
  344. Xarithmetic="arithoh register short int long float double"
  345. Xsystem="syscall pipe context1 spawn execl"
  346. Xmisc="C dc hanoi"
  347. Xdhry="dhry2 dhry2reg" # dhrystone loops
  348. Xload="shell" # cummulative load tests
  349. Xdb="dbmscli" # add to as new database engines are developed
  350. X#
  351. Xargs="" # the accumulator for the bench units to be run
  352. Xrunoption="N"
  353. X# generate list of bench programs
  354. Xfor word
  355. Xdo  # do level 1
  356. X    case $word
  357. X    in
  358. X  all)
  359. X      ;;
  360. X  arithmetic)
  361. X      args="$args $arithmetic"
  362. X      ;;
  363. X  db)
  364. X      args="$args $db"
  365. X      ;;
  366. X  dhry)
  367. X      args="$args $dhry"
  368. X      ;;
  369. X  load)
  370. X      args="$args $load"
  371. X      ;;
  372. X  misc)
  373. X      args="$args $misc"
  374. X      ;;
  375. X  speed)
  376. X      args="$args $arithmetic $system"
  377. X      ;;
  378. X  system)
  379. X      args="$args $system"
  380. X      ;;
  381. X  -q|-Q)
  382. X      runoption="Q" #quiet
  383. X      ;;
  384. X  -v|-V)
  385. X      runoption="V" #verbose
  386. X      ;;
  387. X  -d|-D)
  388. X      runoption="D" #debug
  389. X      ;;
  390. X  *)
  391. X      args="$args $word"
  392. X      ;;
  393. X    esac
  394. X
  395. Xdone # end do level 1
  396. X#if no benchmark units have be specified, do them all 
  397. X# the - option of set implies no options; any list following
  398. X# becomes the line arguments (replacing any that may exist)
  399. Xset - $args
  400. Xif test $# -eq 0  #no arguments specified
  401. X   then
  402. X   set - $FULL_SUITE
  403. Xfi
  404. X
  405. Xif test "$runoption" = 'D'
  406. Xthen
  407. X  set -x
  408. X  set -v
  409. Xfi
  410. X
  411. Xdate=`date`
  412. Xtmp=${TMPDIR}/$$.tmp
  413. Xtimeaccum=${TMPDIR}/time.accum
  414. XLOGFILE=${RESULTDIR}/log
  415. X#add old log to accumulated log or move it
  416. Xif test -w ${RESULTDIR}/log
  417. Xthen
  418. X   if test -w ${RESULTDIR}/log.accum
  419. X   then
  420. X      cat ${RESULTDIR}/log >> ${RESULTDIR}/log.accum
  421. X      rm ${RESULTDIR}/log
  422. X   else
  423. X      mv ${RESULTDIR}/log ${RESULTDIR}/log.accum
  424. X   fi
  425. Xfi
  426. Xecho "Start Benchmark Run (BYTE Version $version)" >>$LOGFILE
  427. Xecho "  $date " >>$LOGFILE
  428. Xecho " " `who | wc -l` "interactive users." >>$LOGFILE
  429. X#if SysV use 'uname -a' -- if BSD use 'hostname'
  430. Xuname -a >>$LOGFILE
  431. X# hostname >>$LOGFILE
  432. X#
  433. X#if not specified, do each bench 6 iterations
  434. Xiter=${iterations-6}
  435. Xif test $iter -eq 6
  436. Xthen
  437. X  longloop="1 2 3 4 5 6"
  438. X  shortloop="1 2 3"
  439. Xelse  # generate list of loop numbers
  440. X  short=`expr \( $iter + 1 \) / 2`
  441. X  longloop=""
  442. X  shortloop=""
  443. X  while test $iter -gt 0
  444. X  do # do level 1
  445. X       longloop="$iter $longloop"
  446. X       if test $iter -le $short
  447. X       then
  448. X         shortloop="$iter $shortloop"
  449. X       fi
  450. X       iter=`expr $iter - 1`
  451. X  done # end do level 1
  452. Xfi #loop list genration
  453. X####################################################################
  454. X############## the major control loop ##############################
  455. X####################################################################
  456. Xfor bench # line argument processing
  457. Xdo # do level 1
  458. X    # set some default values
  459. X    prog=${BINDIR}/$bench  # the bench name is default program
  460. X    need=$prog             # we need the at least the program
  461. X    paramlist="#"          # a dummy parameter to make anything run
  462. X    testdir="${TESTDIR}"   # the directory in which to run the test
  463. X    prepcmd=""             # preparation command or script
  464. X    parammsg=""
  465. X    repeat="$longloop"
  466. X    stdout="$LOGFILE"
  467. X    stdin=""
  468. X    cleanopt="-t $tmp"
  469. X    bgnumber=""
  470. X    trap "${SCRPDIR}/cleanup -l $LOGFILE -a; exit" 1 2 3 15
  471. X    if [ $runoption != 'Q' ]
  472. X    then
  473. X       echo "$bench: \c"
  474. X    fi
  475. X    echo "" >>$LOGFILE
  476. X    ###################### select the bench specific values ##########
  477. X    case $bench
  478. X    in
  479. X  dhry2)
  480. X    options=${dhryloops-10000}
  481. X    logmsg="Dhrystone 2 without register variables"
  482. X    cleanopt="-d $tmp"
  483. X    ;;
  484. X
  485. X  dhry2reg)
  486. X    options=${dhryloops-10000}
  487. X    logmsg="Dhrystone 2 using register variables"
  488. X    cleanopt="-d $tmp"
  489. X    ;;
  490. X
  491. X  arithoh|register|short|int|long)
  492. X    options=${arithloop-10000}
  493. X    logmsg="Arithmetic Test (type = $bench): $options Iterations"
  494. X    ;;
  495. X
  496. X  float|double)
  497. X    options=${arithloop-10000}
  498. X    logmsg="Arithmetic Test (type = $bench): $options Iterations"
  499. X    ;;
  500. X
  501. X  dc)  need=dc.dat
  502. X    prog=dc
  503. X    options=""
  504. X    stdin=dc.dat
  505. X    stdout=/dev/null
  506. X    logmsg="Arithmetic Test (sqrt(2) with dc to 99 decimal places)"
  507. X    ;;
  508. X
  509. X  hanoi)  options='$param'
  510. X    stdout=/dev/null
  511. X    logmsg="Recursion Test: Tower of Hanoi Problem"
  512. X    paramlist="${ndisk-17}"
  513. X    parammsg='$param Disk Problem:'
  514. X    ;;
  515. X
  516. X  syscall)
  517. X    options=${ncall-4000}
  518. X    logmsg="System Call Overhead Test: 5 x $options Calls"
  519. X    ;;
  520. X
  521. X  context1)
  522. X    options=${switch1-500}
  523. X    logmsg="Pipe-based Context Switching Test: 2 x $options Switches"
  524. X    ;;
  525. X
  526. X  pipe)   options=${io-2048}
  527. X    logmsg="Pipe Throughput Test: read & write $options x 512 byte blocks"
  528. X    ;;
  529. X
  530. X  spawn)  options=${children-100}
  531. X    logmsg="Process Creation Test: $options forks"
  532. X    ;;
  533. X
  534. X  execl)  options=${nexecs-100}
  535. X    logmsg="Execl Throughput Test: $options execs"
  536. X    ;;
  537. X
  538. X  fstime) 
  539. X    where=${where-${TMPDIR}}
  540. X    options='$param '"$where"
  541. X    logmsg="Filesystem Throughput Test:"
  542. X    paramlist=${seconds-"1 10 20"}
  543. X    parammsg='Test Time: $param secs'
  544. X    cleanopt="-f $tmp"
  545. X    ;;
  546. X
  547. X  C)   need=cctest.c
  548. X    prog=cc
  549. X    options='$param'
  550. X    stdout=/dev/null
  551. X    repeat="$shortloop"
  552. X    logmsg="C Compiler Test:"
  553. X    paramlist="cctest.c"
  554. X    parammsg='cc $param'
  555. X    rm -f a.out
  556. X    ;;
  557. Xdbmscli)
  558. X    repeat="$shortloop"
  559. X    need="db.dat"
  560. X                          #                   records queuespace
  561. X    prepcmd='${BINDIR}/dbprep ${testdir}/db.dat 1000    1024'
  562. X    paramlist=${clients-"1 2 4 8"}
  563. X    parammsg='$param client processes.'
  564. X    logmsg="Client/Server Database Engine:"
  565. X    options='${testdir}/db.dat $param 0 1000'  # $param clients;
  566. X                           # 0 sleep; 1000 iterations
  567. X    ;;
  568. Xshell)
  569. X    prog="multi.sh"
  570. X    repeat="$shortloop"
  571. X    logmsg="Bourne shell script and Unix utilities"
  572. X    paramlist=${background-"1 2 4 8 "}
  573. X    parammsg='$param concurrent background processes'
  574. X    bgnumber='$param'
  575. X    ;;
  576. X  *)   ${BINDIR}/cleanup -l $LOGFILE -r "run: unknown benchmark \"$bench\"" -a
  577. X    exit 1
  578. X    ;;
  579. Xesac
  580. X################################################################
  581. X###################### the main task ###########################
  582. X###################### run the bench ###########################
  583. X################################################################
  584. X# each of those variables are now used in a general way
  585. X#
  586. Xecho "$break1" >>$LOGFILE                 # break between bench pgms
  587. Xecho "$logmsg" >>$LOGFILE                 # benchmark name
  588. X    for param in $paramlist
  589. X    do   # level 2
  590. X      param=`echo $param | sed 's/_/ /g'` # be sure that spaces are used
  591. X                      # underscore can couple params
  592. X      if [ "$runoption" != "Q" ]
  593. X      then
  594. X         echo "\n   [$param] -\c"           # generate message to user
  595. X      fi
  596. X      eval msg='"'$parammsg'"'            # the eval is used to
  597. X      echo "$break2" >>$LOGFILE           # break between bench pgms
  598. X      if test "$msg"                      # evaluate any embedded
  599. X      then                                # variables in the parammsg
  600. X          echo "$msg" >>$LOGFILE
  601. X      fi
  602. X
  603. X      eval opt='"'$options'"'         # evaluate any vars in options
  604. X      eval prep='"'$prepcmd'"'         # evaluate any prep command
  605. X      eval bg='"'$bgnumber'"'         # evaluate bgnumber string
  606. X      rm -f $tmp             # remove any tmp files
  607. X
  608. X      # if the test requires mulitple concurrent processes,
  609. X      # prepare the background process string (bgstr)
  610. X      # this is just a string of "+"s that will provides a
  611. X      # parameter count for a "for" loop
  612. X      bgstr=""
  613. X      if test "$bg" != ""
  614. X      then
  615. X      count=`expr "$bg"`
  616. X          while test $count -gt 0
  617. X          do
  618. X          bgstr="+ $bgstr"
  619. X          count=`expr $count - 1`
  620. X      done
  621. X      fi
  622. X      #
  623. X      for i in $repeat             # loop for the specified number
  624. X      do  # do depth 3
  625. X          if [ "$runoption" != 'D' ]  # level 1
  626. X      then
  627. X        # regular Run - set logfile to go on signal
  628. X            trap "${BINDIR}/cleanup -l $LOGFILE -i $i $cleanopt -a; exit" 1 2 3 15
  629. X      else
  630. X            trap "exit" 1 2 3 15
  631. X      fi #end level 1
  632. X          if [ "$runoption" != 'Q' ]
  633. X      then
  634. X          echo " $i\c"                  # display repeat number
  635. X      fi
  636. X      pwd=`pwd`                     # remember where we are
  637. X      cd $testdir                   # move to the test directory
  638. X      if [ "$runoption" = "V" ]
  639. X      then
  640. X        echo
  641. X        echo "BENCH COMMAND TO BE EXECUTED:"
  642. X        echo "$prog $opt"
  643. X      fi
  644. X
  645. X      # execute any prepratory command string
  646. X      if [ -n "$prep" ]
  647. X      then
  648. X        $prep 2>&1 >>$stdout 
  649. X      fi
  650. X      ############ THE BENCH IS TIMED ##############
  651. X          if test "$stdin" = ""  
  652. X          then # without redirected stdin
  653. X             time $prog $opt $bgstr 2>>$tmp >>$stdout
  654. X          else # with redirected stdin
  655. X             time $prog $opt $bgstr <$stdin 2>>$tmp >>$stdout
  656. X          fi 
  657. X      time $benchcmd
  658. X      ###############################################
  659. X      cd $pwd                    # move back home
  660. X          status=$?                  # save the result code
  661. X          if test $status != 0 # must have been an error
  662. X          then
  663. X           if test -f $tmp # is there an error file ?
  664. X           then
  665. X                cp $tmp ${TMPDIR}/save.$bench.$param
  666. X            ${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -r \
  667. X           "run: bench=$bench param=$param fatalstatus=$status" -a
  668. X           else
  669. X            ${SCRPDIR}/cleanup -l $LOGFILE -r \
  670. X           "run: bench=$bench param=$param fatalstatus=$status" -a
  671. X           fi 
  672. X           exit # leave the script if there are errors
  673. X          fi # end  level 1
  674. X      done # end do depth 3 - repeat of bench
  675. X      if [ "$runoption" != 'D' ]
  676. X      then
  677. X        ${SCRPDIR}/cleanup -l $LOGFILE $cleanopt # finalize this bench
  678. X                         # with these options
  679. X                         # & calculate results
  680. X      fi
  681. X    done # end do depth 2 - end of all options for this bench
  682. X
  683. X    ########### some specific cleanup routines ##############
  684. X    case $bench
  685. X    in
  686. X      C)
  687. X      rm -f cctest.o a.out
  688. X      ;;
  689. X
  690. X      fstime)
  691. X      sync; sleep 20
  692. X      ;;
  693. X    esac
  694. X    if [ "$runoption" != 'Q' ]
  695. X    then
  696. X       echo ""
  697. X    fi
  698. Xdone # end do level 1  - all benchmarks requested
  699. X########## a few last items for the end ##############
  700. Xecho "" >>$LOGFILE
  701. Xecho " " `who | wc -l` "interactive users." >>$LOGFILE
  702. Xecho "End Benchmark Run ($date) ...." >>$LOGFILE
  703. Xif [ "$runoption" != 'Q' ]
  704. Xthen
  705. X  pg $LOGFILE
  706. Xfi
  707. Xexit
  708. X########################### Amen ######################
  709. END_OF_FILE
  710. echo shar: 1 control character may be missing from \"'Run'\"
  711. if test 13521 -ne `wc -c <'Run'`; then
  712.     echo shar: \"'Run'\" unpacked with wrong size!
  713. fi
  714. chmod +x 'Run'
  715. # end of 'Run'
  716. fi
  717. if test -f 'dummy.c' -a "${1}" != "-c" ; then 
  718.   echo shar: Will not clobber existing file \"'dummy.c'\"
  719. else
  720. echo shar: Extracting \"'dummy.c'\" \(7461 characters\)
  721. sed "s/^X//" >'dummy.c' <<'END_OF_FILE'
  722. X
  723. X/*******************************************************************************
  724. X *  The BYTE UNIX Benchmarks - Release 2
  725. X *          Module: dummy.c   SID: 2.4 4/17/90 16:45:32
  726. X *          
  727. X *******************************************************************************
  728. X * Bug reports, patches, comments, suggestions should be sent to:
  729. X *
  730. X *    Ben Smith or Rick Grehan at BYTE Magazine
  731. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  732. X *
  733. X *******************************************************************************
  734. X *  Modification Log:
  735. X *
  736. X ******************************************************************************/
  737. Xchar SCCSid[] = "@(#) @(#)dummy.c:2.4 -- 4/17/90 16:45:32";
  738. X/*
  739. X *  Hacked up C program for use in the standard shell.? scripts of
  740. X *  the multiuser test.  This is based upon makework.c, and is typically
  741. X *  edited using edscript.2 before compilation.
  742. X *
  743. X * $Header: dummy.c,v 3.4 87/06/23 15:54:53 kjmcdonell Beta $
  744. X */
  745. X
  746. X#include <stdio.h>
  747. X#include <signal.h>
  748. X
  749. X#define DEF_RATE    5.0
  750. X#define GRANULE        5
  751. X#define CHUNK        60
  752. X#define MAXCHILD    12
  753. X#define MAXWORK        10
  754. X
  755. Xfloat    thres;
  756. Xfloat    est_rate = DEF_RATE;
  757. Xint    nusers;        /* number of concurrent users to be simulated by
  758. X             * this process */
  759. Xint    firstuser;    /* ordinal identification of first user for this
  760. X             * process */
  761. Xint    nwork = 0;    /* number of job streams */
  762. Xint    exit_status = 0;    /* returned to parent */
  763. Xint    sigpipe;    /* pipe write error flag */
  764. X
  765. Xstruct st_work {
  766. X    char    *cmd;        /* name of command to run */
  767. X    char    **av;        /* arguments to command */
  768. X    char    *input;        /* standard input buffer */
  769. X    int    inpsize;    /* size of standard input buffer */
  770. X} work[MAXWORK];
  771. X
  772. Xstruct {
  773. X    int    xmit;    /* # characters sent */
  774. X    char    *bp;    /* std input buffer pointer */
  775. X    int    blen;    /* std input buffer length */
  776. X    int    fd;    /* stdin to command */
  777. X    int    pid;    /* child PID */
  778. X    char    *line;    /* start of input line */ 
  779. X    int    firstjob;    /* inital piece of work */
  780. X    int    thisjob;    /* current piece of work */
  781. X} child[MAXCHILD], *cp;
  782. X
  783. Xmain(argc, argv)
  784. Xint    argc;
  785. Xchar    *argv[];
  786. X{
  787. X    int        i;
  788. X    int        l;
  789. X    int        fcopy = 0;    /* fd for copy output */
  790. X    int        master = 1;    /* the REAL master, == 0 for clones */
  791. X    int        nchild;        /* no. of children for a clone to run */
  792. X    int        done;        /* count of children finished */
  793. X    int        output;        /* aggregate output char count for all
  794. X                   children */
  795. X    int        c;
  796. X    int        thiswork = 0;    /* next job stream to allocate */
  797. X    int        nch;        /* # characters to write */
  798. X    int        written;    /* # characters actully written */
  799. X    char    logname[15];    /* name of the log file(s) */
  800. X    int        onalarm();
  801. X    int        pipeerr();
  802. X    int        wrapup();
  803. X    int        grunt();
  804. X    char    *malloc();
  805. X    int        pvec[2];    /* for pipes */
  806. X    char    *p;
  807. X    char    *prog;        /* my name */
  808. X
  809. X#if ! debug
  810. X    freopen("masterlog.00", "a", stderr);
  811. X#endif
  812. X    fprintf(stderr, "*** New Run ***  ");
  813. X    prog = argv[0];
  814. X    while (argc > 1 && argv[1][0] == '-')  {
  815. X    p = &argv[1][1];
  816. X    argc--;
  817. X    argv++;
  818. X    while (*p) {
  819. X        switch (*p) {
  820. X        case 'r':
  821. X            /* code DELETED here */
  822. X            argc--;
  823. X            argv++;
  824. X            break;
  825. X
  826. X        case 'c':
  827. X            /* code DELETED here */
  828. X            lseek(fcopy, 0L, 2);    /* append at end of file */
  829. X            break;
  830. X
  831. X        default:
  832. X        fprintf(stderr, "%s: bad flag '%c'\n", prog, *p);
  833. X            exit(4);
  834. X        }
  835. X        p++;
  836. X    }
  837. X    }
  838. X    
  839. X    if (argc < 2) {
  840. X    fprintf(stderr, "%s: missing nusers\n", prog);
  841. X    exit(4);
  842. X    }
  843. X
  844. X    nusers = atoi(argv[1]);
  845. X    if (nusers < 1) {
  846. X    fprintf(stderr, "%s: impossible nusers (%d<-%s)\n", prog, nusers, argv[1]);
  847. X    exit(4);
  848. X    }
  849. X    fprintf(stderr, "%d Users\n", nusers);
  850. X    argc--;
  851. X    argv++;
  852. X
  853. X    /* build job streams */
  854. X    getwork();
  855. X#if debug
  856. X    dumpwork();
  857. X#endif
  858. X
  859. X    /* clone copies of myself to run up to MAXCHILD jobs each */
  860. X    firstuser = MAXCHILD;
  861. X    fprintf(stderr, "master pid %d\n", getpid());
  862. X    fflush(stderr);
  863. X    while (nusers > MAXCHILD) {
  864. X    fflush(stderr);
  865. X    if (nusers >= 2*MAXCHILD)
  866. X        /* the next clone must run MAXCHILD jobs */
  867. X        nchild = MAXCHILD;
  868. X    else
  869. X        /* the next clone must run the leftover jobs */
  870. X        nchild = nusers - MAXCHILD;
  871. X    if ((l = fork()) == -1) {
  872. X        /* fork failed */
  873. X        fatal("** clone fork failed **\n");
  874. X        goto bepatient;
  875. X    } else if (l > 0) {
  876. X        fprintf(stderr, "master clone pid %d\n", l);
  877. X        /* I am the master with nchild fewer jobs to run */
  878. X        nusers -= nchild;
  879. X        firstuser += MAXCHILD;
  880. X        continue;
  881. X    } else {
  882. X        /* I am a clone, run MAXCHILD jobs */
  883. X#if ! debug
  884. X        sprintf(logname, "masterlog.%02d", firstuser/MAXCHILD);
  885. X        freopen(logname, "w", stderr);
  886. X#endif
  887. X        master = 0;
  888. X        nusers = nchild;
  889. X        break;
  890. X    }
  891. X    }
  892. X    if (master)
  893. X    firstuser = 0;
  894. X
  895. X    close(0);
  896. X
  897. X    /* code DELETED here */
  898. X
  899. X    fflush(stderr);
  900. X
  901. X    srand(time(0));
  902. X    thres = 0;
  903. X    done = output = 0;
  904. X    for (i = 0; i < nusers; i++) {
  905. X    if (child[i].blen == 0)
  906. X        done++;
  907. X    else
  908. X        thres += est_rate * GRANULE;
  909. X    }
  910. X    est_rate = thres;
  911. X
  912. X    signal(SIGALRM, onalarm);
  913. X    signal(SIGPIPE, pipeerr);
  914. X    alarm(GRANULE);
  915. X    while (done < nusers) {
  916. X    for (i = 0; i < nusers; i++) {
  917. X        cp = &child[i];
  918. X        if (cp->xmit >= cp->blen) continue;
  919. X        l = rand() % CHUNK + 1;    /* 1-CHUNK chars */
  920. X        if (l == 0) continue;
  921. X        if (cp->xmit + l > cp->blen)
  922. X        l = cp->blen - cp->xmit;
  923. X        p = cp->bp;
  924. X        cp->bp += l;
  925. X        cp->xmit += l;
  926. X#if debug
  927. X        fprintf(stderr, "child %d, %d processed, %d to go\n", i, cp->xmit, cp->blen - cp->xmit);
  928. X#endif
  929. X        while (p < cp->bp) {
  930. X        if (*p == '\n' || (p == &cp->bp[-1] && cp->xmit >= cp->blen)) {
  931. X            /* write it out */
  932. X            nch = p - cp->line + 1;
  933. X            if ((written = write(cp->fd, cp->line, nch)) != nch) {
  934. X
  935. X            /* code DELETED here */
  936. X
  937. X            }
  938. X            if (fcopy)
  939. X            write(fcopy, cp->line, p - cp->line + 1);
  940. X#if debug
  941. X            fprintf(stderr, "child %d gets \"", i);
  942. X            {
  943. X            char *q = cp->line;
  944. X            while (q <= p) {
  945. X                if (*q >= ' ' && *q <= '~')
  946. X                    fputc(*q, stderr);
  947. X                else
  948. X                    fprintf(stderr, "\\%03o", *q);
  949. X                q++;
  950. X            }
  951. X            }
  952. X            fputc('"', stderr);
  953. X#endif
  954. X            cp->line = &p[1];
  955. X        }
  956. X        p++;
  957. X        }
  958. X        if (cp->xmit >= cp->blen) {
  959. X        done++;
  960. X        close(cp->fd);
  961. X#if debug
  962. X    fprintf(stderr, "child %d, close std input\n", i);
  963. X#endif
  964. X        }
  965. X        output += l;
  966. X    }
  967. X    while (output > thres) {
  968. X        pause();
  969. X#if debug
  970. X        fprintf(stderr, "after pause: output, thres, done %d %.2f %d\n", output, thres, done);
  971. X#endif
  972. X    }
  973. X    }
  974. X
  975. Xbepatient:
  976. X    alarm(0);
  977. X/****
  978. X *  If everything is going OK, we should simply be able to keep
  979. X *  looping unitil 'wait' fails, however some descendent process may
  980. X *  be in a state from which it can never exit, and so a timeout
  981. X *  is used.
  982. X *  5 minutes should be ample, since the time to run all jobs is of
  983. X *  the order of 5-10 minutes, however some machines are painfully slow,
  984. X *  so the timeout has been set at 20 minutes (1200 seconds).
  985. X ****/
  986. X
  987. X    /* code DELETED here */
  988. X
  989. X}
  990. X
  991. Xonalarm()
  992. X{
  993. X    thres += est_rate;
  994. X    signal(SIGALRM, onalarm);
  995. X    alarm(GRANULE);
  996. X}
  997. X
  998. Xgrunt()
  999. X{
  1000. X    /* timeout after label "bepatient" in main */
  1001. X    exit_status = 4;
  1002. X    wrapup();
  1003. X}
  1004. X
  1005. Xpipeerr()
  1006. X{
  1007. X    sigpipe++;
  1008. X}
  1009. X
  1010. Xwrapup()
  1011. X{
  1012. X    /* DUMMY, real code dropped */
  1013. X}
  1014. X
  1015. Xgetwork()
  1016. X{
  1017. X
  1018. X    /* DUMMY, real code dropped */
  1019. X    gets();
  1020. X    strncpy();
  1021. X    malloc(); realloc();
  1022. X    open(); close();
  1023. X}
  1024. X
  1025. Xfatal(s)
  1026. Xchar *s;
  1027. X{
  1028. X    int    i;
  1029. X    fprintf(stderr, s);
  1030. X    fflush(stderr);
  1031. X    perror("Reason?");
  1032. X    for (i = 0; i < nusers; i++) {
  1033. X    if (child[i].pid > 0 && kill(child[i].pid, SIGKILL) != -1)
  1034. X        fprintf(stderr, "pid %d killed off\n", child[i].pid);
  1035. X    }
  1036. X    fflush(stderr);
  1037. X    exit_status = 4;
  1038. X    return;
  1039. X}
  1040. END_OF_FILE
  1041. if test 7461 -ne `wc -c <'dummy.c'`; then
  1042.     echo shar: \"'dummy.c'\" unpacked with wrong size!
  1043. fi
  1044. chmod +x 'dummy.c'
  1045. # end of 'dummy.c'
  1046. fi
  1047. if test -f 'fstime.c' -a "${1}" != "-c" ; then 
  1048.   echo shar: Will not clobber existing file \"'fstime.c'\"
  1049. else
  1050. echo shar: Extracting \"'fstime.c'\" \(4801 characters\)
  1051. sed "s/^X//" >'fstime.c' <<'END_OF_FILE'
  1052. X/*******************************************************************************
  1053. X *  The BYTE UNIX Benchmarks - Release 2
  1054. X *          Module: fstime.c   SID: 2.8 4/17/90 16:45:33
  1055. X *          
  1056. X *******************************************************************************
  1057. X * Bug reports, patches, comments, suggestions should be sent to:
  1058. X *
  1059. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1060. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1061. X *
  1062. X *******************************************************************************
  1063. X *  Modification Log:
  1064. X * $Header: fstime.c,v 3.4 87/06/22 14:23:05 kjmcdonell Beta $
  1065. X * 10/19/89 - rewrote timing calcs and added clock check (Ben Smith)
  1066. X * 10/26/89 - simplify timing, change defaults (Tom Yager)
  1067. X * 11/16/89 - added better error handling and changed output format (Ben Smith)
  1068. X * 11/17/89 - changed the whole thing around (Ben Smith)
  1069. X ******************************************************************************/
  1070. Xchar SCCSid[] = "@(#) @(#)fstime.c:2.8 -- 4/17/90 16:45:33";
  1071. X
  1072. X#include <stdio.h>
  1073. X#include <signal.h>
  1074. X#include <errno.h>
  1075. X
  1076. X#define SECONDS 10
  1077. X#define BUFF_SIZE 1024
  1078. X
  1079. X/****************** GLOBALS ***************************/
  1080. Xchar buf[BUFF_SIZE];
  1081. Xint            seconds = SECONDS;
  1082. Xint            f;
  1083. Xint            g;
  1084. Xint            i;
  1085. Xint            stop_count();
  1086. Xint            clean_up();
  1087. Xint            sigalarm = 0;
  1088. X
  1089. X/******************** MAIN ****************************/
  1090. X
  1091. Xmain(argc, argv)
  1092. Xchar **argv;
  1093. X{
  1094. X
  1095. X/**** initialize ****/
  1096. X    if (argc > 1)
  1097. X    seconds = atoi(argv[1]);
  1098. X    if (argc == 3 && chdir(argv[2]) == -1) 
  1099. X        {
  1100. X        perror("fstime: chdir");
  1101. X        exit(1);
  1102. X        }
  1103. X    if((f = creat("dummy0", 0600)) != -1)
  1104. X            close(f);
  1105. X    else
  1106. X        {
  1107. X        perror("fstime: creat");
  1108. X        exit(1);
  1109. X        }
  1110. X    if((g = creat("dummy1", 0600)) != -1)
  1111. X            close(g);
  1112. X    else
  1113. X        {
  1114. X        perror("fstime: creat");
  1115. X        exit(1);
  1116. X        }
  1117. X    if((f = open("dummy0", 2)) == -1)
  1118. X        {
  1119. X        perror("fstime: open");
  1120. X        exit(1);
  1121. X        }
  1122. X    if((g = open("dummy1", 2)) == -1)
  1123. X        {
  1124. X        perror("fstime: open");
  1125. X        exit(1);
  1126. X        }
  1127. X    /* fill buffer */
  1128. X    for (i = 0; i < BUFF_SIZE; i++)
  1129. X    buf[i] = i & 0177;
  1130. X    /*** run the tests ****/
  1131. X    signal(SIGKILL,clean_up);
  1132. X    if(w_test())
  1133. X    {
  1134. X    clean_up();
  1135. X    exit(1);
  1136. X    }
  1137. X    if(r_test())
  1138. X    {
  1139. X    clean_up();
  1140. X    exit(1);
  1141. X    }
  1142. X    if(c_test())
  1143. X    {
  1144. X    clean_up();
  1145. X    exit(1);
  1146. X    }
  1147. X    clean_up();
  1148. X    exit(0);
  1149. X}
  1150. X
  1151. Xw_test() 
  1152. X/* write test */
  1153. X{
  1154. X    long n_blocks = 0L;
  1155. X    extern int sigalarm;
  1156. X
  1157. X    sync();
  1158. X    sleep(5); /* to insure the sync */
  1159. X
  1160. X    signal(SIGALRM,stop_count);
  1161. X    sigalarm = 0; /* reset alarm flag */
  1162. X    alarm(seconds);
  1163. X    while(!sigalarm)
  1164. X    {
  1165. X    if (write(f, buf, BUFF_SIZE) <= 0)
  1166. X        {
  1167. X            if (errno != EINTR) {
  1168. X            perror("fstime: write");
  1169. X            return(-1);
  1170. X                } else stop_count();
  1171. X        }
  1172. X    ++ n_blocks;
  1173. X        }
  1174. X    /* stop clock */
  1175. X    fprintf(stderr, "%ld Kbytes/sec write (%d second sample)\n", 
  1176. X         (long) n_blocks / (long) seconds, seconds);
  1177. Xreturn(0);
  1178. X}
  1179. X
  1180. Xr_test() 
  1181. X/* read test */
  1182. X{
  1183. X    long n_blocks = 0L;
  1184. X    extern int sigalarm;
  1185. X    extern int errno;
  1186. X
  1187. X    /* rewind */
  1188. X    sync();
  1189. X    sleep(5);
  1190. X    lseek(f, 0L, 0);
  1191. X
  1192. X    signal(SIGALRM,stop_count);
  1193. X    sigalarm = 0; /* reset alarm flag */
  1194. X    alarm(seconds);
  1195. X    while(!sigalarm)
  1196. X    {
  1197. X    if (read(f, buf, BUFF_SIZE) <= 0)
  1198. X        {
  1199. X            if (errno == EINVAL) {
  1200. X                lseek(f, 0L, 0);  /* rewind at end of file */
  1201. X            } else {
  1202. X                if (errno != EINTR) {
  1203. X                   perror("fstime: read");
  1204. X               return(-1);
  1205. X                   } else stop_count();
  1206. X            }
  1207. X            }
  1208. X    ++ n_blocks;
  1209. X        }
  1210. X    /* stop clock */
  1211. X    fprintf(stderr, "%ld Kbytes/sec read (%d second sample)\n", 
  1212. X         (long) n_blocks / (long) seconds, seconds);
  1213. Xreturn(0);
  1214. X}
  1215. X
  1216. X
  1217. Xc_test() 
  1218. X/* copy test */
  1219. X{
  1220. X    long n_blocks = 0L;
  1221. X    extern int sigalarm;
  1222. X
  1223. X    /* rewind */
  1224. X    sync();
  1225. X    sleep(5); /* to insure the sync */
  1226. X    lseek(f, 0L, 0);
  1227. X
  1228. X    signal(SIGALRM,stop_count);
  1229. X    sigalarm = 0; /* reset alarm flag */
  1230. X    alarm(seconds);
  1231. X    while(!sigalarm)
  1232. X    {
  1233. X    if (read(f, buf, BUFF_SIZE) <= 0)
  1234. X        {
  1235. X            if (errno == EINVAL) {
  1236. X                lseek(f, 0L, 0);  /* rewind at end of file */
  1237. X            } else {
  1238. X                if (errno != EINTR) {
  1239. X                    perror("fstime: read");
  1240. X                return(-1);
  1241. X                    } else stop_count();
  1242. X            }
  1243. X            }
  1244. X    if (write(g, buf, BUFF_SIZE) <= 0)
  1245. X        {
  1246. X            if (errno != EINTR) {
  1247. X            perror("fstime: write in copy");
  1248. X            return(-1);
  1249. X                } else stop_count();
  1250. X        }
  1251. X    ++ n_blocks;
  1252. X        }
  1253. X    /* stop clock */
  1254. X    fprintf(stderr, "%ld Kbytes/sec copy (%d second sample)\n", 
  1255. X         (long) n_blocks / (long) seconds, seconds);
  1256. Xreturn(0);
  1257. X}
  1258. X
  1259. Xstop_count()
  1260. X{
  1261. Xextern int sigalarm;
  1262. Xsigalarm = 1;
  1263. Xreturn(0);
  1264. X}
  1265. X
  1266. Xclean_up()
  1267. X{
  1268. Xunlink(f);
  1269. Xunlink(g);
  1270. Xreturn(0);
  1271. X}
  1272. END_OF_FILE
  1273. if test 4801 -ne `wc -c <'fstime.c'`; then
  1274.     echo shar: \"'fstime.c'\" unpacked with wrong size!
  1275. fi
  1276. chmod +x 'fstime.c'
  1277. # end of 'fstime.c'
  1278. fi
  1279. if test -f 'precision.c' -a "${1}" != "-c" ; then 
  1280.   echo shar: Will not clobber existing file \"'precision.c'\"
  1281. else
  1282. echo shar: Extracting \"'precision.c'\" \(5691 characters\)
  1283. sed "s/^X//" >'precision.c' <<'END_OF_FILE'
  1284. X/*******************************************************************************
  1285. X *  The BYTE UNIX Benchmarks - Release 2
  1286. X *          Module: precision.c   SID: 2.4 4/17/90 16:45:35
  1287. X *          
  1288. X *******************************************************************************
  1289. X * Bug reports, patches, comments, suggestions should be sent to:
  1290. X *
  1291. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1292. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1293. X *
  1294. X *******************************************************************************
  1295. X *  Modification Log:
  1296. X *  $Header: precision.c,v 3.5 87/08/06 08:10:59 kenj Exp $
  1297. X *
  1298. X ******************************************************************************/
  1299. Xchar SCCSid[] = "@(#) @(#)precision.c:2.4 -- 4/17/90 16:45:35";
  1300. X/* Program to determine properties of the arithmetic available. */
  1301. X/* Makes certain assumptions about the likely format of numbers */
  1302. X/*                                */
  1303. X/* Author: Steven Pemberton, CWI, Amsterdam. steven@mcvax    */
  1304. X/*                                */
  1305. X/* If your C system is not unix but does have signal/setjmp,    */
  1306. X/*    add a #define unix                    */
  1307. X/* You may also need to change the #include <sys/signal.h> line */
  1308. X/*    and add some calls to signal().                */
  1309. X/*
  1310. X */
  1311. X
  1312. X#ifdef unix
  1313. X
  1314. X#define SIGNAL
  1315. X
  1316. X#include <sys/signal.h>
  1317. X#include <setjmp.h>
  1318. X
  1319. Xjmp_buf lab;
  1320. Xoverflow(sig) int sig; { /*what to do on overflow*/
  1321. X    signal(sig, overflow);
  1322. X    longjmp(lab, 1);
  1323. X}
  1324. X
  1325. X#endif
  1326. X
  1327. Xint tenlog(v) double v; {
  1328. X    /*The largest power of ten less than v*/
  1329. X    int p=0;
  1330. X    while (v>10) { p++; v/=10; }
  1331. X    return p;
  1332. X}
  1333. X
  1334. Xint two(v) int v; {
  1335. X    /* (the closest power of two to v)-1 */
  1336. X    int t=1, s;
  1337. X    while (t<v) t=t*2+1;
  1338. X    s=(t-1)/2;
  1339. X    if ((v-s)>(t-v)) return(t);
  1340. X    return(s);
  1341. X}
  1342. X
  1343. Xdouble twopower(n, e) int n, *e; {
  1344. X    /* Calculate 2**n without overflow worries */
  1345. X    /* Result is r*10**e */
  1346. X    double r=1.0; *e=0;
  1347. X    while (n-- > 0) {
  1348. X        r*=2.0;
  1349. X        if (r>10.0) { r/=10.0; (*e)++; }
  1350. X    }
  1351. X    return(r);
  1352. X}
  1353. X
  1354. Xmain() {
  1355. X    short maxshort, newshort;
  1356. X    int maxint, newint, i, maxfexp, maxdexp, bits,
  1357. X        fmantis, dmantis, ddmantis,
  1358. X        shortpower, intpower, longpower,
  1359. X        fpower, dpower, fipower, dipower, ddipower, lpower, base;
  1360. X    long maxlong, newlong;
  1361. X    float maxfloat, newfloat, sum, f, maxifloat;
  1362. X    double maxdouble, newdouble, maxidouble, maxiexpr,
  1363. X           d, incr, dsum;
  1364. X
  1365. X#ifdef SIGNAL
  1366. X    signal(SIGFPE, overflow); /*signal(SIGOVER, overflow);*/
  1367. X#endif
  1368. X
  1369. X/****** Calculate max short *********************************************/
  1370. X/*      Calculate 2**n-1 until overflow - then use the previous value    */
  1371. X
  1372. X    newshort=1; maxshort=0;
  1373. X#ifdef SIGNAL
  1374. X    if (setjmp(lab)==0)
  1375. X#endif
  1376. X    for(shortpower=0; newshort>maxshort; shortpower++) {
  1377. X        maxshort=newshort;
  1378. X        newshort=newshort*2+1;
  1379. X    }
  1380. X    bits= (shortpower+1)/sizeof(short);
  1381. X    printf("maxshort=%d (=2**%d-1)\n", maxshort, shortpower);
  1382. X
  1383. X/****** Calculate max int by the same method ***************************/
  1384. X
  1385. X    newint=1; maxint=0;
  1386. X#ifdef SIGNAL
  1387. X    if (setjmp(lab)==0)
  1388. X#endif
  1389. X    for(intpower=0; newint>maxint; intpower++) {
  1390. X        maxint=newint;
  1391. X        newint=newint*2+1;
  1392. X    }
  1393. X    printf("maxint=%d (=2**%d-1)\n", maxint, intpower);
  1394. X
  1395. X/****** Calculate max long by the same method ***************************/
  1396. X
  1397. X    newlong=1; maxlong=0;
  1398. X#ifdef SIGNAL
  1399. X    if (setjmp(lab)==0)
  1400. X#endif
  1401. X    for(longpower=0; newlong>maxlong; longpower++) {
  1402. X        maxlong=newlong;
  1403. X        newlong=newlong*2+1;
  1404. X    }
  1405. X    printf("maxlong=%ld (=2**%d-1)\n", maxlong, longpower);
  1406. X
  1407. X/****** Calculate max float, assuming it's a power of two ***************/
  1408. X/*    Calculate 2**i until it overflows, and then use the nearest    */
  1409. X/*    power of two (some machines overflow early, some late)        */
  1410. X
  1411. X    newfloat=1; maxfloat=0;
  1412. X#ifdef SIGNAL
  1413. X    if (setjmp(lab)==0)
  1414. X#endif
  1415. X    for(i=0;newfloat>maxfloat;i++) {
  1416. X        maxfloat=newfloat;
  1417. X        newfloat=newfloat*2;
  1418. X    }
  1419. X    maxfexp=two(i); maxfloat=twopower(maxfexp, &fpower);
  1420. X    printf("maxfloat=~%fE%d (=~2**%d) (%d bits)\n",
  1421. X            maxfloat, fpower, maxfexp, sizeof(float)*bits);
  1422. X
  1423. X/****** Calculate max double, assuming it's a power of two **************/
  1424. X
  1425. X    newdouble=1; maxdouble=0;
  1426. X#ifdef SIGNAL
  1427. X    if (setjmp(lab)==0)
  1428. X#endif
  1429. X    for(i=0;newdouble>maxdouble;i++) {
  1430. X        maxdouble=newdouble;
  1431. X        newdouble*=2;
  1432. X    }
  1433. X#ifdef SIGNAL
  1434. X    if (setjmp(lab)!=0) { printf("\nUnexpected overflow\n"); exit(1); }
  1435. X#endif
  1436. X    maxdexp=two(i); maxdouble=twopower(maxdexp, &dpower);
  1437. X    printf("maxdouble=~%fE%d (=~2**%d) (%d bits)\n",
  1438. X            maxdouble, dpower, maxdexp, sizeof(double)*bits);
  1439. X
  1440. X/****** Calculate the accuracy for float, double, and expressions *******/
  1441. X/*    maxintfloat and maxintdouble are the largest values that can    */
  1442. X/*    still be integer values; ie such that (x+1)-x=1.        */
  1443. X/*    Some systems really do use extra precision in expressions    */
  1444. X
  1445. X    f=2.0; incr=1.0; sum=f+incr;
  1446. X    for (fmantis=0; sum>2.0; fmantis++) { incr/=2; sum=f+incr; }
  1447. X    printf("max float exp=%d mantissa bits=%d\n", maxfexp, fmantis);
  1448. X
  1449. X    d=2.0; incr=1.0; dsum=d+incr;
  1450. X    for (dmantis=0; dsum>2.0; dmantis++) { incr/=2; dsum=d+incr; }
  1451. X    printf("max double exp=%d mantissa bits=%d\n", maxdexp, dmantis);
  1452. X
  1453. X    d=2.0; incr=1.0;
  1454. X    for (ddmantis=0; d+incr>2.0; ddmantis++) incr/=2;
  1455. X
  1456. X    maxifloat=twopower(fmantis, &fipower);
  1457. X    printf("maxintfloat=~%fE%d (=2**%d-1) (%d digit precision)\n",
  1458. X            maxifloat, fipower, fmantis, fipower);
  1459. X
  1460. X    maxidouble=twopower(dmantis, &dipower);
  1461. X    printf("maxintdouble=~%fE%d (=2**%d-1) (%d digit precision)\n",
  1462. X            maxidouble, dipower, dmantis, dipower);
  1463. X
  1464. X    maxiexpr=twopower(ddmantis, &ddipower);
  1465. X    printf("maxint for expressions=~%fE%d (=2**%d-1) (%d digit precision)\n",
  1466. X            maxiexpr, ddipower, ddmantis, ddipower);
  1467. X
  1468. X/****** BASE is the largest power of ten such that BASE*BASE can be    */
  1469. X/*    computed exactly as a double, and BASE+BASE as a long, useful    */
  1470. X/*    for multi-length arithmetic                    */
  1471. X
  1472. X    lpower= tenlog((double)(maxlong/2));
  1473. X    base= (dipower/2)>lpower?lpower:(dipower/2);
  1474. X    printf("BASE=1E%d\n", base);
  1475. X    
  1476. X    exit(0);
  1477. X}
  1478. END_OF_FILE
  1479. if test 5691 -ne `wc -c <'precision.c'`; then
  1480.     echo shar: \"'precision.c'\" unpacked with wrong size!
  1481. fi
  1482. chmod +x 'precision.c'
  1483. # end of 'precision.c'
  1484. fi
  1485. if test -f 'sort.src' -a "${1}" != "-c" ; then 
  1486.   echo shar: Will not clobber existing file \"'sort.src'\"
  1487. else
  1488. echo shar: Extracting \"'sort.src'\" \(8555 characters\)
  1489. sed "s/^X//" >'sort.src' <<'END_OF_FILE'
  1490. Xversion="1.2"
  1491. Xumask 022    # at least mortals can read root's files this way
  1492. XPWD=`pwd`
  1493. XHOMEDIR=${HOMEDIR:-.}
  1494. Xcd $HOMEDIR
  1495. XHOMEDIR=`pwd`
  1496. Xcd $PWD
  1497. XBINDIR=${BINDIR:-${HOMEDIR}/pgms}
  1498. Xcd $BINDIR
  1499. XBINDIR=`pwd`
  1500. Xcd $PWD
  1501. XPATH="${PATH}:${BINDIR}"
  1502. XSCRPDIR=${SCRPDIR:-${HOMEDIR}/pgms}
  1503. Xcd $SCRPDIR
  1504. XSCRPDIR=`pwd`
  1505. Xcd $PWD
  1506. XTMPDIR=${HOMEDIR}/tmp
  1507. Xcd $TMPDIR
  1508. XTMPDIR=`pwd`
  1509. Xcd $PWD
  1510. XRESULTDIR=${RESULTDIR:-${HOMEDIR}/results}
  1511. Xcd $RESULTDIR
  1512. XRESULTDIR=`pwd`
  1513. Xcd $PWD
  1514. XTESTDIR=${TESTDIR:-${HOMEDIR}/testdir}
  1515. Xcd $TESTDIR
  1516. XTESTDIR=`pwd`
  1517. Xcd $PWD
  1518. Xexport BINDIR TMPDIR RESULTDIR PATH
  1519. Xbell=""
  1520. Xecho "kill -9 $$" > ${TMPDIR}/kill_run ; chmod u+x ${TMPDIR}/kill_run
  1521. Xarithmetic="arithoh register short int long float double dc"
  1522. Xsystem="syscall pipe context1 spawn execl fstime"
  1523. Xmem="seqmem randmem"
  1524. Xmisc="C shell"
  1525. Xdhry="dhry2 dhry2reg" # dhrystone loops
  1526. Xdb="dbmscli" # add to as new database engines are developed
  1527. Xload="shell" # cummulative load tests
  1528. Xargs="" # the accumulator for the bench units to be run
  1529. Xrunoption="N"
  1530. Xfor word
  1531. Xdo  # do level 1
  1532. Xcase $word
  1533. Xin
  1534. Xall)
  1535. X;;
  1536. Xarithmetic)
  1537. Xargs="$args $arithmetic"
  1538. X;;
  1539. Xdb)
  1540. Xargs="$args $db"
  1541. X;;
  1542. Xdhry)
  1543. Xargs="$args $dhry"
  1544. X;;
  1545. Xload)
  1546. Xargs="$args $load"
  1547. X;;
  1548. Xmem)
  1549. Xargs="$args $mem"
  1550. X;;
  1551. Xmisc)
  1552. Xargs="$args $misc"
  1553. X;;
  1554. Xspeed)
  1555. Xargs="$args $arithmetic $system"
  1556. X;;
  1557. Xsystem)
  1558. Xargs="$args $system"
  1559. X;;
  1560. X-q|-Q)
  1561. Xrunoption="Q" #quiet
  1562. X;;
  1563. X-v|-V)
  1564. Xrunoption="V" #verbose
  1565. X;;
  1566. X-d|-D)
  1567. Xrunoption="D" #debug
  1568. X;;
  1569. X*)
  1570. Xargs="$args $word"
  1571. X;;
  1572. Xesac
  1573. Xdone # end do level 1
  1574. Xset - $args
  1575. Xif test $# -eq 0  #no arguments specified
  1576. Xthen
  1577. Xset - $dhry $arithmetic $system $misc  # db and work not included
  1578. Xfi
  1579. Xif test "$runoption" = 'D'
  1580. Xthen
  1581. Xset -x
  1582. Xset -v
  1583. Xfi
  1584. Xdate=`date`
  1585. Xtmp=${TMPDIR}/$$.tmp
  1586. XLOGFILE=${RESULTDIR}/log
  1587. Xif test -w ${RESULTDIR}/log
  1588. Xthen
  1589. Xif test -w ${RESULTDIR}/log.accum
  1590. Xthen
  1591. Xcat ${RESULTDIR}/log >> ${RESULTDIR}/log.accum
  1592. Xrm ${RESULTDIR}/log
  1593. Xelse
  1594. Xmv ${RESULTDIR}/log ${RESULTDIR}/log.accum
  1595. Xfi
  1596. Xecho "Start Benchmark Run (BYTE Version $version)" >>$LOGFILE
  1597. Xecho "  $date (long iterations $iter times)" >>$LOGFILE
  1598. Xecho " " `who | wc -l` "interactive users." >>$LOGFILE
  1599. Xuname -a >>$LOGFILE
  1600. Xiter=${iterations-6}
  1601. Xif test $iter -eq 6
  1602. Xthen
  1603. Xlongloop="1 2 3 4 5 6"
  1604. Xshortloop="1 2 3"
  1605. Xelse  # generate list of loop numbers
  1606. Xshort=`expr \( $iter + 1 \) / 2`
  1607. Xlongloop=""
  1608. Xshortloop=""
  1609. Xwhile test $iter -gt 0
  1610. Xdo # do level 1
  1611. Xlongloop="$iter $longloop"
  1612. Xif test $iter -le $short
  1613. Xthen
  1614. Xshortloop="$iter $shortloop"
  1615. Xfi
  1616. Xiter=`expr $iter - 1`
  1617. Xdone # end do level 1
  1618. Xfi #loop list genration
  1619. Xfor bench # line argument processing
  1620. Xdo # do level 1
  1621. X# set some default values
  1622. Xprog=${BINDIR}/$bench  # the bench name is default program
  1623. Xneed=$prog             # we need the at least the program
  1624. Xparamlist="#"          # a dummy parameter to make anything run
  1625. Xtestdir="${TESTDIR}"   # the directory in which to run the test
  1626. Xprepcmd=""             # preparation command or script
  1627. Xparammsg=""
  1628. Xrepeat="$longloop"
  1629. Xstdout="$LOGFILE"
  1630. Xstdin=""
  1631. Xcleanopt="-t $tmp"
  1632. Xbgnumber=""
  1633. Xtrap "${SCRPDIR}/cleanup -l $LOGFILE -a; exit" 1 2 3 15
  1634. Xif [ $runoption != 'Q' ]
  1635. Xthen
  1636. Xecho "$bench: \c"
  1637. Xfi
  1638. Xecho "" >>$LOGFILE
  1639. X###################### select the bench specific values ##########
  1640. Xcase $bench
  1641. Xin
  1642. Xdhry2)
  1643. Xoptions=${dhryloops-10000}
  1644. Xlogmsg="Dhrystone 2 without register variables"
  1645. Xcleanopt="-d $tmp"
  1646. X;;
  1647. Xdhry2reg)
  1648. Xoptions=${dhryloops-10000}
  1649. Xlogmsg="Dhrystone 2 using register variables"
  1650. Xcleanopt="-d $tmp"
  1651. X;;
  1652. Xarithoh|register|short|int|long|float|double)
  1653. Xoptions=${arithloop-10000}
  1654. Xlogmsg="Arithmetic Test (type = $bench): $options Iterations"
  1655. X;;
  1656. Xdc)  need=dc.dat
  1657. Xprog=dc
  1658. Xoptions=""
  1659. Xstdin=dc.dat
  1660. Xstdout=/dev/null
  1661. Xlogmsg="Arithmetic Test (sqrt(2) with dc to 99 decimal places)"
  1662. X;;
  1663. Xhanoi)  options='$param'
  1664. Xstdout=/dev/null
  1665. Xlogmsg="Recursion Test: Tower of Hanoi Problem"
  1666. Xparamlist="${ndisk-17}"
  1667. Xparammsg='$param Disk Problem:'
  1668. X;;
  1669. Xsyscall)
  1670. Xoptions=${ncall-4000}
  1671. Xlogmsg="System Call Overhead Test: 5 x $options Calls"
  1672. X;;
  1673. Xcontext1)
  1674. Xoptions=${switch1-500}
  1675. Xlogmsg="Pipe-based Context Switching Test: 2 x $options Switches"
  1676. X;;
  1677. Xpipe)   options=${io-2048}
  1678. Xlogmsg="Pipe Throughput Test: read & write $options x 512 byte blocks"
  1679. X;;
  1680. Xspawn)  options=${children-100}
  1681. Xlogmsg="Process Creation Test: $options forks"
  1682. X;;
  1683. Xexecl)  options=${nexecs-100}
  1684. Xlogmsg="Execl Throughput Test: $options execs"
  1685. X;;
  1686. Xrandmem|seqmem)
  1687. Xif test $bench = seqmem
  1688. Xthen
  1689. Xtype=Sequential
  1690. Xelse
  1691. Xtype=Random
  1692. Xfi
  1693. Xpoke=${poke-1000000}
  1694. Xoptions='-s$param '"-n$poke"
  1695. Xlogmsg="$type Memory Access Test: $poke Accesses"
  1696. Xparamlist=${arrays-"512 1024 2048 8192 16384"}
  1697. Xparammsg='Array Size: $param bytes'
  1698. Xcleanopt="-m $tmp"
  1699. X;;
  1700. Xfstime) repeat="$shortloop"
  1701. Xwhere=${where-${TMPDIR}}
  1702. Xoptions='$param '"$where"
  1703. Xlogmsg="Filesystem Throughput Test:"
  1704. Xparamlist=${blocks-"512 1024 2048 8192"}
  1705. Xparammsg='File Size: $param blocks'
  1706. Xcleanopt="-f $tmp"
  1707. X;;
  1708. XC)   need=cctest.c
  1709. Xprog=cc
  1710. Xoptions='$param'
  1711. Xstdout=/dev/null
  1712. Xrepeat="$shortloop"
  1713. Xlogmsg="C Compiler Test:"
  1714. Xparamlist="cctest.c"
  1715. Xparammsg='cc $param'
  1716. Xrm -f a.out
  1717. X;;
  1718. Xdbmscli)
  1719. Xrepeat="$shortloop"
  1720. Xneed="db.dat"
  1721. Xprepcmd='${BINDIR}/dbprep ${testdir}/db.dat 10000'
  1722. Xparamlist=${clients-"1 2 4 8"}
  1723. Xparammsg='$param client processes. (filesize `cat ${testdir}/db.dat|wc -c` bytes)'
  1724. Xlogmsg="Client/Server Database Engine:"
  1725. Xoptions='${testdir}/db.dat $param 0 1000'  # $param clients;
  1726. X# 0 sleep; 1000 iterations
  1727. X;;
  1728. Xshell)
  1729. Xprog="multi.sh"
  1730. Xrepeat="$shortloop"
  1731. Xlogmsg="Bourne shell script and Unix utilities"
  1732. Xparamlist=${background-"1 2 4 8"}
  1733. Xparammsg='$param concurrent background processes'
  1734. Xbgnumber='$param'
  1735. Xtestdir="shelldir"
  1736. X;;
  1737. X*)   ${BINDIR}/cleanup -l $LOGFILE -r "run: unknown benchmark \"$bench\"" -a
  1738. Xexit 1
  1739. X;;
  1740. Xesac
  1741. Xecho "$logmsg" >>$LOGFILE
  1742. Xfor param in $paramlist
  1743. Xdo   # level 2
  1744. Xparam=`echo $param | sed 's/_/ /g'` # be sure that spaces are used
  1745. X# underscore can couple params
  1746. Xif [ "$runoption" != "Q" ]
  1747. Xthen
  1748. Xecho "\n   [$param] -\c"           # generate message to user
  1749. Xfi
  1750. Xeval msg='"'$parammsg'"'            # the eval is used to
  1751. Xif test "$msg"                      # evaluate any embedded
  1752. Xthen                                # variables in the parammsg
  1753. Xecho "" >>$LOGFILE
  1754. Xecho "$msg" >>$LOGFILE
  1755. Xfi
  1756. Xeval opt='"'$options'"'   # evaluate any vars in options
  1757. Xeval prep='"'$prepcmd'"'   # evaluate any prep command
  1758. Xeval bg='"'$bgnumber'"'   # evaluate bgnumber string
  1759. Xrm -f $tmp    # remove any tmp files
  1760. X# if the test requires mulitple concurrent processes,
  1761. X# prepare the background process string (bgstr)
  1762. X# this is just a string of "+"s that will provides a
  1763. X# parameter count for a "for" loop
  1764. Xbgstr=""
  1765. Xif test "$bg" != ""
  1766. Xthen
  1767. Xcount=`expr "$bg"`
  1768. Xwhile test $count -gt 0
  1769. Xdo
  1770. Xbgstr="+ $bgstr"
  1771. Xcount=`expr $count - 1`
  1772. Xdone
  1773. Xfi
  1774. X#
  1775. Xfor i in $repeat    # loop for the specified number
  1776. Xdo  # do depth 3
  1777. Xif [ "$runoption" != 'D' ]  # level 1
  1778. Xthen
  1779. X# regular Run - set logfile to go on signal
  1780. Xtrap "${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -a; exit" 1 2 3 15
  1781. Xelse
  1782. Xtrap "exit" 1 2 3 15
  1783. Xfi #end level 1
  1784. Xif [ "$runoption" != 'Q' ]
  1785. Xthen
  1786. Xecho " $i\c"                  # display repeat number
  1787. Xfi
  1788. Xpwd=`pwd`                     # remember where we are
  1789. Xcd $testdir                   # move to the test directory
  1790. Xif [ "$runoption" = "V" ]
  1791. Xthen
  1792. Xecho
  1793. Xecho "BENCH COMMAND TO BE EXECUTED:"
  1794. Xecho "$prog $opt"
  1795. Xfi
  1796. X# execute any prepratory command string
  1797. Xif [ -n "$prep" ]
  1798. Xthen
  1799. X$prep >>$stdout 
  1800. Xfi
  1801. X############ THE BENCH IS TIMED ##############
  1802. Xif test "$stdin" = ""  
  1803. Xthen # without redirected stdin
  1804. Xtime $prog $opt $bgstr 2>>$tmp >>$stdout
  1805. Xelse # with redirected stdin
  1806. Xtime $prog $opt $bgstr <$stdin 2>>$tmp >>$stdout
  1807. Xfi 
  1808. Xtime $benchcmd
  1809. X###############################################
  1810. Xcd $pwd                    # move back home
  1811. Xstatus=$?                  # save the result code
  1812. Xif test $status != 0 # must have been an error
  1813. Xthen
  1814. Xif test -f $tmp # is there an error file ?
  1815. Xthen
  1816. Xcp $tmp ${TMPDIR}/save.$bench.$param
  1817. X${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -r \
  1818. X"run: bench=$bench param=$param fatalstatus=$status" -a
  1819. Xelse
  1820. X${SCRPDIR}/cleanup -l $LOGFILE -r \
  1821. X"run: bench=$bench param=$param fatalstatus=$status" -a
  1822. Xfi 
  1823. Xexit # leave the script if there are errors
  1824. Xfi # end  level 1
  1825. Xdone # end do depth 3 - repeat of bench
  1826. Xif [ "$runoption" != 'D' ]
  1827. Xthen
  1828. X${SCRPDIR}/cleanup -l $LOGFILE $cleanopt # finalize this bench
  1829. X# with these options
  1830. X# & calculate results
  1831. Xfi
  1832. Xdone # end do depth 2 - end of all options for this bench
  1833. X########### some specific cleanup routines ##############
  1834. Xcase $bench
  1835. Xin
  1836. XC)
  1837. Xrm -f cctest.o a.out
  1838. X;;
  1839. Xesac
  1840. Xif [ "$runoption" != 'Q' ]
  1841. Xthen
  1842. Xecho ""
  1843. Xfi
  1844. Xdone # end do level 1  - all benchmarks requested
  1845. Xecho "" >>$LOGFILE
  1846. Xecho " " `who | wc -l` "interactive users." >>$LOGFILE
  1847. Xecho "End Benchmark Run ($date) ...." >>$LOGFILE
  1848. Xif [ "$runoption" != 'Q' ]
  1849. Xthen
  1850. Xpg $LOGFILE
  1851. Xfi
  1852. Xexit
  1853. END_OF_FILE
  1854. echo shar: 1 control character may be missing from \"'sort.src'\"
  1855. if test 8555 -ne `wc -c <'sort.src'`; then
  1856.     echo shar: \"'sort.src'\" unpacked with wrong size!
  1857. fi
  1858. chmod +x 'sort.src'
  1859. # end of 'sort.src'
  1860. fi
  1861. echo shar: End of archive 2 \(of 5\).
  1862. cp /dev/null ark2isdone
  1863. MISSING=""
  1864. for I in 1 2 3 4 5 ; do
  1865.     if test ! -f ark${I}isdone ; then
  1866.     MISSING="${MISSING} ${I}"
  1867.     fi
  1868. done
  1869. if test "${MISSING}" = "" ; then
  1870.     echo You have unpacked all 5 archives.
  1871.     rm -f ark[1-9]isdone
  1872. else
  1873.     echo You still need to unpack the following archives:
  1874.     echo "        " ${MISSING}
  1875. fi
  1876. ##  End of shell archive.
  1877. exit 0
  1878. exit 0 # Just in case...
  1879.